package todo

import org.vaillant.todo.User;

class UserFilters {

	def filters = {
		secureActions(controller:'todo', action:'*') {
			before = {
				
				if (params.loggedUser){
					session.user = User.findById(params.loggedUser)
				}

				if (!session.user) {
					redirect(controller: 'user', action: 'login')
					return false
				}
				
			}
			after = {
			}
			afterView = {
			}
		}
	}
}
